home *** CD-ROM | disk | FTP | other *** search
- >So we're faced then with either having the spec say that:
- > - FD_CLOSE doesn't occur *at all* on a socket that initiates the close
- > (with shutdown() or with closesocket()), since in effect it just
- > tells you something you already know.
- > OR
- > - FD_CLOSE does *not* occur after calling closesocket() to initiate the
- > close of a TCP connection, but it *does* occur after calling
- > shutdown()
- >
- >That's about as transparent as my cafe latte.
- >
- I don't have a problem with it. You get an FD_CLOSE when a _socket_ goes
- into FIN_WAIT state. After a closesocket the socket does not exist
- (altho the connection might), so you won't get any more messages.
-
- >> and if an app really needs
- >> to find out if the connection closed gracefully, it should hang onto
- >> the
- >> descriptor, use shutdown(1) to send a FIN, then read to EOF.
- >
- >I couldn't agree with this more. The problem is that most people
- >don't know this method, as evidenced by most WinSock applications
- >around these days.
-
- OK, so maybe we need to throw a mention of it in the FAQ.
-
- >> I still maintain that closesocket invalidates the descriptor and what
- >> would an app do if it didn't get the FD_CLOSE it expected? Reset the
- >> connection? It can't, because it has no reference to the connection
- >> now
- >> that the socket descriptor is gone. It might display a warning to
- >> the
- >> user, but since it can't take any meaningful steps to correct the
- >> problem,
- >> this would amount to "I've fallen, and I can't get up!"
- >
- >As much as I like that error message, I think it might be more
- >meaningful to a user to say something like "the connection on
- >the remote host was disconnected unexpectedly".
- >
- Actually, the app _didn't get an FD_CLOSE, so the message would be more
- like "the connection on the remote host unexpectedly didn't disconnect".
- Huh? :) I still don't know what meaningful action an app could take
- based on the knowledge that the connection associated with a nonexistant
- socket has been closed.
-
-
- ****************************************
- Bruce A Backman (Bruce@FrontierTech.COM)
- Frontier Technologies Corporation
- 10201 North Port Washington Road
- Mequon, WI 53092
- ****************************************
-
-